<?php
?>
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<title>Upload File To Server</title>
	</head>
	<body>
		<?
			if(isset($_POST["upload"]))
			{
				$file_name = $_FILES["uploadfile"]['name'];
				if($file_name != "")
				{
					$new_dir = "../uploadfile";
					if(!file_exists($new_dir))
						mkdir($new_dir);

					$new_path = $new_dir.'/'.$file_name;
					move_uploaded_file($_FILES["uploadfile"]['tmp_name'],$new_path);
					echo "Upload successful to '$new_path'";
				}
			}
		?>
		<form method="post" action="" onsubmit="return autoformFormCheck()" enctype="multipart/form-data">
			<div class="w800" align="center">
				<div class="w780">
					<table cellspacing="0" cellpadding="0" border = "0">
						<tr>
							<td class="h30 w200">
								<table cellspacing="0" cellpadding="10" border="0">
									<tr>
										<td style="padding: 0px 5px; font-size: 11px;" align="right" width="20%">
										<strong>File :</strong> <br>
										</td>
										<td>
										<input id="uploadfile" name="uploadfile" size="30" type="file">
										</td>
									</tr>
								</table>
							</td>
						</tr>
						<tr> 
							<td class="h30 w100" align="center">
								<button type="submit" name="upload">Upload</button>
							</td>
						</tr>
					</table>
				</div>
			</div>
		</form>	
	</body>
</html>
